Learning Objectives

After completing this lesson, you’ll be able to:

Instructions

In this lesson, you will:

Resources

Exercise

Jennifer

Jennifer manages a collection of orthophotos for the city of Vancouver. Her workspace reads GeoTIFF orthophotos from a local folder, clips them to downtown neighborhood boundaries, and writes the results as individual raster files. She needs to configure a FeatureReader to read only the photos that overlap the neighborhoods, and a FeatureWriter so the workspace can continue processing after writing, uploading the files to an FTP server.

In this exercise, you will:

1) Start Workbench

2) Explore the Workspace

The workspace already reads a KML dataset of Vancouver neighborhoods, removes some attributes, and reprojects them. You will add the FeatureReader and FeatureWriter to complete it. If you examine the workspace, you'll see the following:

Starting workspace

  1. It reads a vector dataset of the neighborhoods in KML format, removes some attributes, and reprojects them.
  2. We will add the FeatureReader to read the photos based on the areas of the neighborhoods.
  3. It will mosaic the rasters into one image using the RasterMosaicker.
  4. Then, it will clip the neighborhood features out to create individual raster features using the Clipper.
  5. Then, it will process the rasters to set a NoData band so the areas outside the photo are transparent.
  6. Then, we must configure a FeatureWriter to write out the individual raster files.
  7. Then, we can use a Connector transformer to upload the files to a web storage location.

3) Add a FeatureReader

Use a Dissolver to combine all neighborhood features into a single geometry, then use that as a single initiator feature for the FeatureReader. This ensures each orthophoto is read only once, even if it intersects multiple neighborhoods.

Connecting Dissolver to FeatureReader

Matching orthophotos

Map tiles © Stadia Maps, © OpenMapTiles, © OpenStreetMap contributors, © Stamen Design

4) Disconnect the Dissolver

For your workspace, you want to read each photo intersecting any neighborhood just once, which is why you used a Dissolver to get a single initiator feature. However, you can also use the FeatureReader in scenarios with multiple initiators. If you skip the Dissolver, you will read some photos multiple times, once for each neighborhood they intersect. Try it out to see the difference.

5) Run the Workspace

Now that the FeatureReader is configured, connect it to the rest of the workspace and run it to verify your results. You should see the orthophotos clipped to the neighborhood outlines, with transparent pixels in areas outside the neighborhood boundaries.

Connecting the FeatureReader to the RasterMosaiker

Orthophotos clipped to neighborhood boundaries

Map tiles © Stadia Maps, © OpenMapTiles, © OpenStreetMap contributors, © Stamen Design

6) Add a FeatureWriter

Now that the orthophotos have been clipped to the neighborhood boundaries, you will write them out as individual GeoTIFF files, one per neighborhood. Use a FeatureWriter instead of a standard writer. This allows your workspace to continue processing after the data has been written.

Connecting to a FeatureWriter

Set output file name to NeighborhoodName

Open Containing Folder and output files

7) Add an FTPCaller Transformer

Now that the FeatureWriter has written the files locally, you will use an FTPCaller to upload them to an FTP server. The FeatureWriter creates a _dataset attribute containing the path to the written file, which you will use to tell the FTPCaller where to find it.

Alternatively, you can try using a different Connector transformer with a web service you have access to, like a GoogleDriveConnector or DropboxConnector.

_dataset parameter